package com.woniuxy02;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;

/**
 * @author 作者
 * @create 2025-06-06 14:23
 */
public class Test04 {
    public static void main(String[] args) {
        HashSet<Student> students = new HashSet<>();
        Student s1 = new Student(1, "zs", 11);
        Student s4 = new Student(1, "zs", 11);
        students.add(s1);
        students.add(new Student(2, "ls", 12));
        students.add(new Student(3, "ww", 13));
        students.add(s4);
        for (Student s : students) {
            System.out.println(s);
        }
        System.out.println(s1==s4);
        System.out.println(s1.equals(s4));

        System.out.println(s1.hashCode());
        System.out.println(s4.hashCode());


    }

    private static void test02() {
        ArrayList<Student> students = new ArrayList<>();
        students.add(new Student(1, "zs", 11));
        students.add(new Student(2, "ls", 12));
        students.add(new Student(3, "ww", 13));
        students.add(new Student(1, "zs", 11));
        for (Student s : students) {
            System.out.println(s);
        }
    }

    private static void test01() {
        HashSet<String> strs = new HashSet<>();
        strs.add("aaa");
        strs.add("aaa");
        strs.add("aaa");
        strs.add("aaa");
        strs.add("bbb");
        strs.add("ccc");
        strs.add("ddd");
        System.out.println(strs);
    }


}
